package com.wswy.wzcx.widget.utils;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

public class DotView extends View {

  private static final String TAG = "DotView";

  public DotView(Context context) {
    this(context,null);
  }

  public DotView(Context context,
      @Nullable AttributeSet attrs) {
    this(context, attrs,0);
  }

  public DotView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    init();
  }

  private ShapeDrawable drawable;

  private void init(){

    drawable = new ShapeDrawable(new OvalShape());


  }

  public void setColor(int color) {
    drawable.getPaint().setColor(color);
  }


  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    drawable.setBounds(0,0,getWidth(),getHeight());
    drawable.draw(canvas);

  }



}
